agint <- ag %>% mutate(treat=dplyr::recode(treat, '1' = 0,'2' = 1, '3' = 3, '4'=4))

agint <- agint[agint$state !="NJ",]

agint <- agint %>%
	mutate(trumptercile = ntile(two_party_trump_pct, 3))
agint$trumptercile <- as.factor(agint$trumptercile)

model_cluster <- lm(yes~treat*trumptercile+factor(match_id), data=agint)

model_cluster_robust <- coeftest(model_cluster, vcov.=rddtools::vcovCluster(model_cluster, clusterVar=agint$match_id), cluster = agint$match_id)


stargazer(model_cluster,
		  type = "latex", 
		  se = gaze.coeft(list(model_cluster_robust)), 
		  omit = "match_id",
		  add.lines = list(c("Matched Pair FE", "Yes")),
		  intercept.bottom = FALSE, 
		  keep.stat = c("rsq", "n"), 
		  digits=2, 
		  star.cutoffs = c(0.05, 0.01, 0.001),
		  dep.var.labels = "Agreed to Discuss Collaboration",
		  covariate.labels = c("Intercept", "Ranking Condition","Middle Trump Vote Share Tercile", "Top Trump Vote Share Tercile", "Ranking Condition X Middle Trump Vote Share Tercile","Ranking Condition X Top Trump Vote Share Tercile"), 
		  out = "results/tablee5.tex")
